package com.example.blogemail.config;

import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.connection.PublisherCallbackChannel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @className: RabbitMq
 * @author: shuishui
 * @date: 2023/02/03 11:44
 */
@Configuration
public class RabbitMqConfig {
    @Bean
    public DirectExchange messageExchange(){
        return new DirectExchange("message-exchange");//创建一个交换机
    }
    @Bean
    public Queue emailQue(){
        return new Queue("email-work",true,true,false);
    }
    @Bean
    public Binding bangding(){
        return BindingBuilder.bind(emailQue()).to(messageExchange()).with("email");
    }
}
